import java.util.Scanner;

public class Retirement {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            System.out.print("How much money do you need to retire? ");
            double goal = in.nextDouble();

            System.out.print("How much money will you contribute every year? ");
            double payment = in.nextDouble();

            System.out.print("Interest rate in %: ");
            double interestRate = in.nextDouble();

            double balance = 0;
            int years = 0;

            while (balance < goal) {
                // compute interest amount from current balance
                double interest = balance * interestRate / 100;
                balance += interest + payment;
                years++;
            }

            System.out.println("You can retire in " + years + " years.");
        }
    }
}
